home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Apple Shared Library Manager / ASLM Examples / Sample INIT / Sources / ShowInit.a < prev    next >
Encoding:
Text File  |  1996-11-19  |  15.6 KB  |  546 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        ShowInit.a
  3. ;
  4. ;    Contains:    Implementation of the ShowInit routine
  5. ;
  6. ;    Copyright:    © 1992-1994 by Apple Computer, Inc., all rights reserved.
  7. ;
  8. ;
  9.  
  10. ;------------------------------------------------------------------------------------------------
  11. ;
  12. ;    INIT notification routine
  13. ;     by Paul Mercer, Darin Adler, Paul Snively,
  14. ;        Frédéric Miserey, and Alex Rosenberg from an idea by Steve Capps
  15. ;
  16. ;    Created:  6/7/87  PM    - First version.
  17. ;    Modified: 6/15/87 PM    - Changed to standard (Pascal) calling conventions.
  18. ;          6/20/87 PM    - Fixed color & Finder bug on Mac II.
  19. ;          6/22/87 DBA    - Improved handling of QuickDraw.
  20. ;          6/29/87 DBA    - Used scratch8 to avoid conflict with “Easy Access”.
  21. ;          6/30/87 DBA    - Changed to a 4-byte scheme with “checksum”.
  22. ;          6/30/87 PFS    - Separated into ShowINIT and InnerShowINIT.
  23. ;          7/1/87  DBA    - Fixed stack bug and switched to CurApName+.
  24. ;          7/2/87  PM    - Added check for old signature in ApplScratch for
  25. ;                   backword compatibility (TMON Startup).
  26. ;          7/3/87  PM    - Removed _SysBeep in ErrorExit since it causes a crash.
  27. ;                   Also changed ICN# plotter to srcOr mode for Blinker.
  28. ;          7/13/87 PM    - Fixed a3 trashing bug in InnerShowINIT - exit code left
  29. ;                   word on stack (reported by D. Dunham).
  30. ;          7/21/87 PM    - Due to popular demand, InitGraf is no longer being called.
  31. ;                   This avoids the gamma correction problem with Startupscreens
  32. ;                   getting  “washed out” by ShowINIT though someone else is still
  33. ;                   bound to call InitGraf sooner or later (i.e. InitWindows).
  34. ;          7/29/87 PM    - Put InitGraf back in; this is required (reported by C. Derossi
  35. ;                   at Apple Tech Support).  Took out GetPort/SetPort.
  36. ;        10/06/87  PM    - Set CurrentA5 properly.  Rearranged myVars.
  37. ;        12/28/87  PM    - Major revision to accomodate future INIT31 based ShowINIT.
  38. ;        07/14/88  PM    - Major revision to get rid of above 'accomodations'.
  39. ;                   Added color icon 'cicn' support and fixed beep crash.
  40. ;                   Removed support for old signature.
  41. ;        11/25/89 FCM    - Added Y dimension support, icl48 support to get rid of 'obsolete' cicns
  42. ;        3/27/90  AMR    - 'cicn's were not being drawn in their native size.
  43. ;
  44. ;------------------------------------------------------------------------------------------------
  45.  
  46.         INCLUDE    'Traps.a'
  47.         INCLUDE    'QuickEqu.a'
  48.         INCLUDE    'SysEqu.a'
  49.         INCLUDE    'ToolEqu.a'
  50.  
  51.         BLANKS  ON
  52.         STRING  ASIS
  53.  
  54. True        equ    1
  55. False        equ    0
  56.  
  57. Debug        equ    True
  58. ;Debug        equ    False
  59.  
  60. myVCheck    equ    CurApName+32-8        ; a GREAT place to store 8 bytes (it was Darin's idea)
  61. myV        equ    myVCheck+2
  62. myH        equ    myV+2
  63. myHCheck    equ    myH+2            ; a simple checksum of myH to determine first-timeness
  64. firstX        equ    8            ; X coordinate of first icon to be drawn
  65. bottomEdge    equ    8+32            ; this far from bottom of screen
  66. iconWidth    equ    32            ; size of icon (square normally)
  67. visBuff        equ    8            ; a visual buffer between icons of 8 pixels
  68. defaultMoveX    equ    iconWidth+visBuff    ; x default amount to move icons (40 pixels)
  69. defaultMoveY    equ    40            ; y icon line height
  70. checksumConst    equ    $1021            ; constant used for computing checksum
  71. minColorDepth    equ    4            ; minimum bits/pixel for drawing color icons
  72.  
  73. maskOffset    equ    128            ; offset to mask in ICN#
  74. iconRowBytes    equ    32/8            ; 32/8 bits
  75.  
  76. hasCQDBit    equ    6            ; this bit in ROM85 is cleared if Color QuickDraw is available
  77.  
  78. iconID        equ    6+4            ; positive stackframe objects
  79. moveX        equ    4+4
  80. showINITArgs    equ    4
  81.  
  82. iconPtrHdl    equ    6+4
  83. initDrawArgs    equ    6
  84.  
  85. iclPtrHdl    equ    12+4
  86. iclDepth    equ    10+4
  87. initDrawXArgs    equ    initDrawArgs+6
  88.  
  89. myVars        RECORD    0,DECREMENT
  90. saveA5        ds.l    1
  91. localA5        ds.l    1
  92. thePort        ds.l    1            ; my own QuickDraw (required!)
  93.         ds.b    grafSize-4        ;  other QuickDraw globals (except thePort)
  94. destRect    ds.w    4
  95. currMoveX    ds.w    1            ; holds current moveX value
  96. myBitMap    ds.b    bitmapRec
  97. myPort        ds.b    portRec
  98. varsSize    equ    *
  99.         ENDR
  100.  
  101.  
  102. ;------------------------------------------------------------------------------------------------
  103. ;
  104. ;    Displays the ICN# (cicn when in 4 bit mode or higher) specified by iconID and
  105. ;     move the pen horizontally by moveX.
  106. ;    Pass a -1 in moveX to move the standard amount, moveX should be 40 for most ICN#'s
  107. ;
  108. ;    PROCEDURE ShowINIT(iconID: Integer; moveX: Integer); EXTERNAL
  109. ;
  110. ;    pascal void ShowINIT(iconID, moveX)
  111. ;        short iconID, moveX;
  112. ;        extern;
  113. ;
  114. ;------------------------------------------------------------------------------------------------
  115. SHOWINIT:    PROC    EXPORT
  116.         IMPORT    INITDraw1Bit, INITDrawCQD,INITDrawXBit
  117.  
  118.         link    a6,#0            ; create stack frame
  119.         movem.l    d3-d7/a2-a4,-(sp)    ; save standard registers
  120.  
  121.         btst.b    #hasCQDBit,ROM85    ; try to get a color icon if CQD exists
  122.         beq.s    ShowINITCQD        ; I could use SysEnvirons but I don't want to
  123. ShowINIT1Bit
  124.         subq.w    #4,sp            ; try to get the icon resource
  125.         move.l    #'ICN#',-(sp)
  126.         move.w    iconID(a6),-(sp)
  127.         _GetResource
  128.         move.l    (sp)+,d0
  129.         beq.s    ShowINITError        ; can't get it, give up
  130.  
  131.         move.l    d0,-(sp)        ; leave handle on the stack for ReleaseResource
  132.         move.l    d0,a0
  133.         _HLock
  134.         move.l    (a0),a0            ; dereference
  135.         move.l    a0,-(sp)        ; icon pointer
  136.         move.w    moveX(a6),-(sp)        ; moveX
  137.         bsr    INITDraw1Bit        ; draw
  138.         _ReleaseResource        ; release the resource
  139.  
  140. ShowINITExit:
  141.         movem.l    (sp)+,d3-d7/a2-a4    ; restore registers
  142.         unlk    a6            ; ditch stack frame
  143.         move.l    (sp)+,a0        ; get return address
  144.         addq.l    #showINITArgs,sp    ; ditch incoming arguments
  145.         jmp    (a0)            ; return to caller
  146.  
  147. ShowINITError:
  148.         IF    Debug THEN
  149.         move.w    #1,-(sp)        ; just beep
  150.         _SysBeep
  151.         ENDIF
  152.         bra.s    ShowINITExit
  153.  
  154.  
  155. ShowINITCQD:    
  156.         move.l    #$40008,d2
  157.         move.l    #'icl8',d3
  158.         move.l    #'icl4',d4
  159.         move.l    MainDevice,a0        ; get handle to main device
  160.         move.l    (a0),a0            ; dereference
  161.         move.l    gdPMap(a0),a0        ; get its pixmap handle
  162.         move.l    (a0),a0            ; dereference it
  163.         cmp.w    #minColorDepth,pmPixelSize(a0)    ; is it deep enough for us to draw in color?
  164.         blt.s    ShowINIT1Bit            ;  no
  165.         bne.s    noSwapOrder            ; is depth 4 ?
  166.         swap    d2                ; yes - swap icl_ search order
  167.         exg    d3,d4
  168. noSwapOrder:
  169.         subq.w    #4,sp
  170.         move.l    d3,-(sp)
  171.         move.w    iconID(a6),-(sp)
  172.         _GetResource
  173.         move.l    (sp)+,d1
  174.         beq.s    SearchNext
  175. FoundIc:
  176.         subq.w    #4,sp
  177.         move.l    #'ICN#',-(sp)
  178.         move.w    iconID(a6),-(sp)
  179.         _GetResource
  180.         move.l    (sp)+,d0
  181.         bne.s    FoundCompanion
  182.         
  183.         move.l    d1,-(sp)
  184.         _ReleaseResource
  185.         bra.s    ShowINITError
  186. FoundCompanion:        
  187.         move.l    d1,-(sp)        ; leave handle on the stack for ReleaseResource
  188.         move.l    d0,-(sp)        ; leave handle on the stack for ReleaseResource
  189.         move.l    d0,d3
  190.         
  191.         move.l    d1,a0
  192.         _HLock
  193.         move.l    (a0),a0            ; dereference
  194.         move.l    a0,-(sp)        ; icl_ pointer
  195.         move.w    d2,-(sp)        ; icl_ depth
  196.         move.l    d3,a0
  197.         _HLock
  198.         move.l    (a0),a0            ; dereference
  199.         move.l    a0,-(sp)        ; icon pointer
  200.         move.w    moveX(a6),-(sp)        ; moveX
  201.         bsr    INITDrawXBit        ; draw
  202.         _ReleaseResource        ; release the resource
  203.         _ReleaseResource        ; release the resource
  204.         bra    ShowINITExit
  205. SearchNext:
  206.         swap    d2
  207.         subq.w    #4,sp
  208.         move.l    d4,-(sp)
  209.         move.w    iconID(a6),-(sp)
  210.         _GetResource
  211.         move.l    (sp)+,d1
  212.         bne.s    FoundIc
  213.  
  214.         subq.w    #4,sp            ; can a color icon be found?
  215.         move.w    iconID(a6),-(sp)
  216.         _GetCIcon
  217.         move.l    (sp)+,d0
  218.         beq    ShowINIT1Bit        ;  no, so try for regular icon
  219.  
  220.         move.l    d0,-(sp)        ; leave handle on the stack for DisposCIcon
  221.         move.l    d0,-(sp)        ; cicn handle
  222.         move.w    moveX(a6),-(sp)        ; moveX
  223.         bsr    INITDrawCQD        ; do the actual drawing
  224.         _DisposCIcon
  225.  
  226.         bra    ShowINITExit
  227.  
  228. ShowINITCredits:
  229.         dc.w    'ShowINIT by Paul Mercer'
  230.         dc.w    'Copyright 1987-1990'
  231.         dc.w    'Version of 03/27/90'
  232.         ENDPROC
  233.  
  234.  
  235. ;------------------------------------------------------------------------------------------------
  236. ;
  237. ;    Initializes the world and sets up the drawing rectangle
  238. ;
  239. ;------------------------------------------------------------------------------------------------
  240. INITInit:    PROC    EXPORT
  241.         WITH    myVars
  242.  
  243.         move.l    CurrentA5,saveA5(a6)    ; PM 10/6 save host A5
  244.         lea    localA5(a6),a5        ; PM7/21
  245.         move.l    a5,CurrentA5
  246.         pea    thePort(a6)        ; PM 10/6 use a5 reference instead of a6
  247.         _InitGraf            ; fixes color bug as per DA@ICOM
  248.         pea    myPort(a6)
  249.         _OpenPort
  250.  
  251.         move.w    myV,d0            ; get my v var
  252.         rol.w    #1,d0            ; compare against checksum
  253.         eor.w    #checksumConst,d0
  254.         cmp.w    myVCheck,d0
  255.         beq.s    ScratchVOK        ; checks, so go on test my h var
  256.  
  257.         move    myPort+portBounds+bottom(a6),d0 ; else initialize as first time
  258.         sub.w    #bottomEdge,d0
  259.         move    d0,myV
  260. ScratchVOK:
  261.         move.w    myH,d0            ; get my h var
  262.         rol.w    #1,d0            ; compare against checksum
  263.         eor.w    #checksumConst,d0
  264.         cmp.w    myHCheck,d0
  265.         beq.s    ScratchHOK        ; checks, so go on
  266.         move    #firstX,myH        ; else initialize as first time
  267. ScratchHOK:
  268.         move.l    myV,d0
  269.  
  270.         move.w    d0,d1            ; get future position
  271.         add.w    #iconWidth,d1        ; compute future rect right
  272.         cmp.w    myPort+portBounds+right(A6),d1 ; compare to main screen right
  273.         blt.s    DontChangeLine        ; smaller - do nothing
  274.  
  275.         move.w    myV,d0            ; decrement Y value
  276.         subi.w    #defaultMoveY,d0
  277.         move.w    d0,myV
  278.         moveq    #firstX,D0
  279.         move    d0,myH            ; set X to initial value
  280.  
  281.         move.l    myV,d0
  282. DontChangeLine:
  283.         move.l    d0,destRect(a6)
  284.         move.l    d0,destRect+botRight(a6)
  285.         add.w    #iconWidth,destRect+right(a6)
  286.         add.w    #iconWidth,destRect+bottom(a6)
  287.  
  288.         move.w    #defaultMoveX,currMoveX(a6)    ; establish a default
  289.                             ; INITDrawCQD changes this
  290.         rts
  291.  
  292.         ENDWITH
  293.         ENDPROC
  294.  
  295.  
  296. ;------------------------------------------------------------------------------------------------
  297. ;
  298. ;    Cleans up the work done by INITInit and advances the icon drawing position
  299. ;
  300. ;------------------------------------------------------------------------------------------------
  301. INITCleanup:    PROC    EXPORT
  302.         WITH    myVars
  303.  
  304.         move.w    myH,d0            ; get current position
  305.         move.w    moveX(a6),d1        ; get delta x
  306.         bpl.s    NotDefault        ; not default (-1)
  307.         move.w    currMoveX(a6),d1    ; default - set in INITInit and INITDrawCQD
  308. NotDefault:
  309.         add.w    d1,d0            ; increment icon position
  310.         move.w    d0,myH            ;  and save in ‘global’
  311. computeChecksum:
  312.         rol.w    #1,d0            ; recompute h checksum
  313.         eor.w    #checksumConst,d0
  314.         move.w    d0,myHCheck        ;  and save it
  315.  
  316.         move    myV,d0            ; same for v checksum
  317.         rol.w    #1,d0
  318.         eor.w    #checksumConst,d0
  319.         move.w    d0,myVCheck
  320. Exit:
  321.         pea    myPort(a6)
  322.         _ClosePort
  323.         ; *** (DBA) I think that QuickDraw leaves handles around.
  324.         ; *** (DBA) Too bad we can't get rid of them...
  325.         move.l    saveA5(a6),a5        ; PM 10/6 restore host A5
  326.         move.l    a5,CurrentA5
  327.         rts
  328.  
  329.         ENDWITH
  330.         ENDPROC
  331.  
  332.  
  333. ;------------------------------------------------------------------------------------------------
  334. ;
  335. ;    display the ICN# pointed to by iconPtr and move the pen horizontally by moveX
  336. ;     pass a -1 in moveX to move the standard amount, moveX should be 40 for most ICN#'s
  337. ;
  338. ;    PROCEDURE INITDraw1Bit(iconPtr: ICONListPtr; moveX: Integer); EXTERNAL
  339. ;
  340. ;    pascal void INITDraw1Bit(iconPtr, moveX)
  341. ;        ICONList *iconPtr;
  342. ;        short moveX;
  343. ;        extern;
  344. ;
  345. ;------------------------------------------------------------------------------------------------
  346. INITDraw1Bit:    PROC    EXPORT
  347.         IMPORT    INITInit, INITCleanup:CODE
  348.         WITH    myVars
  349.  
  350.         link    a6,#varsSize        ; create stack frame
  351.         movem.l    d3-d7/a2-a4,-(sp)    ; save standard registers
  352.         bsr    INITInit        ; initialize for drawing
  353.  
  354.         move.l    iconPtrHdl(a6),a3    ; get ICN# pointer
  355.         lea    myBitMap(a6),a4        ; point to bitmap structure
  356.         move.l    a3,baseAddr(a4)        ; fill it out
  357.         add.l    #maskOffset,baseAddr(a4) ; skip to mask
  358.         move    #iconRowBytes,rowBytes(a4)
  359.         moveq    #0,d0
  360.         move.l    d0,bounds(a4)        ; 0,0 topleft
  361.         move.l    #(iconWidth<<16)+iconWidth,bounds+bottom(a4) ; 32,32 botright
  362.         
  363.         move.l    a4,-(sp)        ; punch hole with mask
  364.         lea    myPort(a6),a2        ; get the desk port
  365.         pea    portBits(a2)        ;  for its portbits
  366.         pea    srcRect
  367.         pea    destRect(a6)
  368.         move    #srcBic,-(sp)        ; punch a hole
  369.         clr.l    -(sp)            ; no clip region
  370.         _CopyBits
  371.  
  372.         sub.l    #128,baseAddr(a4)
  373.         move.l    a4,-(sp)        ; now draw (or) icon
  374.         pea    portBits(a2)
  375.         pea    srcRect
  376.         pea    destRect(a6)
  377.         move    #srcOr,-(sp)
  378.         clr.l    -(sp)
  379.         _CopyBits
  380.  
  381.         bsr    INITCleanup        ; cleanup, advance icon location
  382.         movem.l    (sp)+,d3-d7/a2-a4    ; restore registers
  383.         unlk    a6            ; ditch stack frame
  384.         move.l    (sp)+,a0        ; get return address
  385.         addq.l    #initDrawArgs,sp    ; ditch incoming
  386.         jmp    (a0)            ; back to caller
  387.  
  388. srcRect:    dc.w    0,0,32,32        ; for copybits
  389.  
  390.         ENDWITH
  391.         ENDPROC
  392.  
  393.  
  394. ;------------------------------------------------------------------------------------------------
  395. ;
  396. ;    display the Icl pointed to by iclPtr and move the pen horizontally by moveX
  397. ;     pass a -1 in moveX to move the standard amount, moveX should be 40 for most ICN#'s
  398. ;
  399. ;    PROCEDURE INITDrawXBit(iclPtr: icl_Ptr; iclDepth: Integer; 
  400. ;                iconPtr: ICONListPtr; moveX: Integer); EXTERNAL
  401. ;
  402. ;    pascal void INITDrawXBit(iconPtr, moveX)
  403. ;        icl_Ptr *iclPtr;
  404. ;        short iclDepth;
  405. ;        ICONList *iconPtr;
  406. ;        short moveX;
  407. ;        extern;
  408. ;
  409. ;------------------------------------------------------------------------------------------------
  410. INITDrawXBit:    PROC    EXPORT
  411.         IMPORT    INITInit, INITCleanup:CODE
  412.         WITH    myVars
  413.  
  414.         
  415.         link    a6,#varsSize        ; create stack frame
  416.         movem.l    d3-d7/a2-a4,-(sp)    ; save standard registers
  417.         
  418.         subq.w    #4,sp
  419.         _NewPixMap
  420.         move.l    (sp)+,d0
  421.         bne.s    pixIsGood
  422.         
  423.         move.l    iconPtrHdl(a6),-(sp)
  424.         move    moveX(a6),-(sp)
  425.         bsr    INITDraw1Bit
  426.         bra    quickEnd
  427. pixIsGood:    
  428.         move.l    d0,a2
  429.         
  430.         bsr    INITInit        ; initialize for drawing
  431.  
  432.         movea.l    a2,a0
  433.         _HLock
  434.         movea.l    (a2),a0
  435.         movea.l    pmTable(a0),a0
  436.         _DisposeHandle
  437.         subq.w    #4,sp
  438.         move.l    #'clut',-(sp)
  439.         move.w    iclDepth(a6),-(sp)
  440.         _RGetResource
  441.         movea.l    (a2),a0
  442.         move.l    (sp)+,pmTable(a0)
  443.         
  444.         move.l    iclPtrHdl(a6),pmBaseAddr(a0)
  445.         moveq    #iconRowBytes,d0
  446.         move.w    iclDepth(a6),d1
  447.         mulu    d1,d0
  448.         bset.l    #15,d0
  449.         move.w    d0,pmRowBytes(a0)
  450.         moveq    #0,d0
  451.         move.l    d0,pmBounds(a0)        ; 0,0 topleft
  452.         move.l    #(iconWidth<<16)+iconWidth,pmBounds+bottom(a0) ; 32,32 botright
  453.         move.w    #chunky,pmPixelType(a0)
  454.         move.w    d1,pmPixelSize(a0)
  455.         move.w    #1,pmCmpCount(a0)
  456.         move.w    d1,pmCmpSize(a0)
  457.         
  458.         lea    myBitMap(a6),a4        ; point to bitmap structure
  459.         move.l    iconPtrHdl(a6),baseAddr(a4) ; fill it out with ICN# pointer
  460.         add.l    #maskOffset,baseAddr(a4) ; skip to mask
  461.         move    #iconRowBytes,rowBytes(a4)
  462.         moveq    #0,d0
  463.         move.l    d0,bounds(a4)        ; 0,0 topleft
  464.         move.l    #(iconWidth<<16)+iconWidth,bounds+bottom(a4) ; 32,32 botright
  465.         
  466.         move.l    (a2),d0
  467.         move.l    d0,-(sp)
  468.         move.l    a4,-(sp)        ; punch hole with mask
  469.         pea    myPort+portBits(a6)    ; get the desk port portbits
  470.         pea    srcRect
  471.         pea    srcRect
  472.         pea    destRect(a6)
  473.         _CopyMask
  474.         
  475.         moveq    #0,d0
  476.         _NewHandle
  477.         movea.l    (a2),a1
  478.         move.l    a0,pmTable(a1)
  479.         move.l    a2,-(sp)
  480.         _DisposPixMap
  481.  
  482.         bsr    INITCleanup        ; cleanup, advance icon location
  483. quickEnd    movem.l    (sp)+,d3-d7/a2-a4    ; restore registers
  484.         unlk    a6            ; ditch stack frame
  485.         move.l    (sp)+,a0        ; get return address
  486.         adda.w    #initDrawXArgs,sp    ; ditch incoming
  487.         jmp    (a0)            ; back to caller
  488.  
  489. srcRect:    dc.w    0,0,iconWidth,iconWidth    ; for copymask
  490.  
  491.         ENDWITH
  492.         ENDPROC
  493.  
  494.  
  495. ;------------------------------------------------------------------------------------------------
  496. ;    same as above except with color icon handle
  497. ;------------------------------------------------------------------------------------------------
  498. INITDrawCQD:    PROC    EXPORT
  499.         IMPORT    INITInit, INITCleanup:CODE
  500.         WITH    myVars
  501.  
  502.         link    a6,#varsSize        ; create stack frame
  503.         movem.l    d3-d7/a2-a4,-(sp)    ; save standard registers
  504.         bsr    INITInit        ; initialize for drawing
  505.  
  506.         move.l    iconPtrHdl(a6),a0
  507.         move.l    (a0),a0
  508.         move.w    pmBounds+right(a0),d0    ; (right - left - iconWidth) + destRect.right
  509.         move.w    pmBounds+left(a0),d1
  510.         sub.w    d1,d0
  511.         
  512.         move.w    #visBuff,d1
  513.         move.w    d0,currMoveX(a6)
  514.         add.w    d1,currMoveX(a6)    ; (right - left) -> currMoveX
  515.         
  516.         move.w    #iconWidth,d1
  517.         subx.w    d1,d0
  518.         move.w    destRect+right(a6),d1
  519.         addx.w    d0,d1
  520.         move.w    d1,destRect+right(a6)
  521.         move.w    pmBounds+bottom(a0),d0    ; (bottom - top - iconWidth) + destRect.bottom
  522.         move.w    pmBounds+top(a0),d1
  523.         sub.w    d1,d0
  524.         move.w    #iconWidth,d1
  525.         subx.w    d1,d0
  526.         move.w    destRect+bottom(a6),d1
  527.         addx.w    d0,d1
  528.         move.w    d1,destRect+bottom(a6)
  529.  
  530.         pea    destRect(a6)        ; destination rect
  531.         move.l    iconPtrHdl(a6),-(sp)    ; cicn handle
  532.         _PlotCIcon            ; draw it
  533.  
  534.         bsr    INITCleanup        ; cleanup, advance icon location
  535.         movem.l    (sp)+,d3-d7/a2-a4    ; restore registers
  536.         unlk    a6            ; ditch stack frame
  537.         move.l    (sp)+,a0        ; get return address
  538.         addq.l    #initDrawArgs,sp    ; ditch incoming
  539.         jmp    (a0)            ; back to caller
  540.  
  541.         ENDWITH
  542.         ENDPROC
  543.  
  544.  
  545.         END
  546.